﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Remoting.Messaging;

using MessageCallAspect.Inspector.Attributes;
using System.Diagnostics;

namespace MessageCallAspect.Aspect.Trace
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
    public sealed class TraceAspectAttribute : MessageSinkAttribute
    {
        public TraceAspectCondition TraceAspectCondition { get; set; }
        public TraceAspectAttribute()
        {
            TraceAspectCondition = TraceAspectCondition.BeforeInvoke | TraceAspectCondition.AfterInvoke;
        }
        public override IMessageSink CreateMessageSink(IServiceProvider context, object target, IMessageSink nextSink)
        {
            return new TraceMessageSink(context, TraceAspectCondition, target, nextSink);
        }
    }
}
